home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / arabian.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  10KB  |  330 lines

  1. /***************************************************************************
  2.  
  3. Arabian memory map (preliminary)
  4.  
  5. 0000-1fff ROM 0
  6. 2000-3fff ROM 1
  7. 4000-5fff ROM 2
  8. 6000-7fff ROM 3
  9. 8000-bfff VIDEO RAM
  10.  
  11. d000-dfff RAM
  12. e000-e100 CRT controller  ? blitter ?
  13.  
  14. memory mapped ports:
  15. read:
  16. d7f0 - IN 0
  17. d7f1 - IN 1
  18. d7f2 - IN 2
  19. d7f3 - IN 3
  20. d7f4 - IN 4
  21. d7f5 - IN 5
  22. d7f6 - clock HI  ?
  23. d7f7 - clock set ?
  24. d7f8 - clock LO  ?
  25.  
  26. c000 - DSW 0
  27. c200 - DSW 1
  28.  
  29. DSW 0
  30. bit 7 = ?
  31. bit 6 = ?
  32. bit 5 = ?
  33. bit 4 = ?
  34. bit 3 = ?
  35. bit 2 = 1 - test mode
  36. bit 1 = COIN 2
  37. bit 0 = COIN 1
  38.  
  39. DSW 1
  40. bit 7 - \
  41. bit 6 - - coins per credit    (ALL=1 free play)
  42. bit 5 - -
  43. bit 4 - /
  44. bit 3 - carry bowls / don't carry bowls to next level (0 DON'T CARRY)
  45. bit 2 - PIC NORMAL or FLIPPED (0 NORMAL)
  46. bit 1 - COCKTAIL or UPRIGHT   (0 COCKTAIL)
  47. bit 0 - LIVES 0=3 lives 1=5 lives
  48.  
  49. write:
  50. c800 - AY-3-8910 control
  51. ca00 - AY-3-8910 write
  52.  
  53. ON AY PORTS there are two things :
  54.  
  55. port 0x0e (write only) to do ...
  56.  
  57. port 0x0f (write only) controls (active LO):
  58. BIT 0 -    coin counter 1
  59. BIT 1 - coin counter 2
  60. BIT 2 -
  61. BIT 3 -
  62. BIT 4 - 0-read RAM  1-read switches(ports)
  63. BIT 5 -
  64. BIT 6 -
  65. BIT 7 -
  66.  
  67. interrupts:
  68. standart IM 1 interrupt mode (rst #38 every vblank)
  69.  
  70. ***************************************************************************/
  71.  
  72. #include "driver.h"
  73. #include "vidhrdw/generic.h"
  74.  
  75.  
  76.  
  77. void arabian_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  78. int arabian_vh_start(void);
  79. void arabian_vh_stop(void);
  80. void arabian_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  81. WRITE_HANDLER( arabian_blitter_w );
  82. WRITE_HANDLER( arabian_videoram_w );
  83.  
  84. int arabian_interrupt(void);
  85. WRITE_HANDLER( arabian_portB_w );
  86. READ_HANDLER( arabian_input_port_r );
  87.  
  88.  
  89. static struct MemoryReadAddress readmem[] =
  90. {
  91.     { 0x0000, 0x7fff, MRA_ROM },
  92.     { 0xc000, 0xc000, input_port_0_r },
  93.     { 0xc200, 0xc200, input_port_1_r },
  94.     { 0xd000, 0xd7ef, MRA_RAM },
  95.     { 0xd7f0, 0xd7ff, arabian_input_port_r },
  96.     { -1 }  /* end of table */
  97. };
  98.  
  99. static struct MemoryWriteAddress writemem[] =
  100. {
  101.     { 0x0000, 0x7fff, MWA_ROM },
  102.     { 0x8000, 0xbfff, arabian_videoram_w, &videoram },
  103.     { 0xd000, 0xd7ff, MWA_RAM },
  104.     { 0xe000, 0xe07f, arabian_blitter_w, &spriteram },
  105.     { -1 }  /* end of table */
  106. };
  107.  
  108.  
  109.  
  110. static struct IOWritePort writeport[] =
  111. {
  112.     { 0xc800, 0xc800, AY8910_control_port_0_w },
  113.     { 0xca00, 0xca00, AY8910_write_port_0_w },
  114.     { -1 }    /* end of table */
  115. };
  116.  
  117.  
  118.  
  119. INPUT_PORTS_START( arabian )
  120.     PORT_START      /* IN0 */
  121.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  122.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  123.     PORT_SERVICE( 0x04, IP_ACTIVE_HIGH )
  124.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  125.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  126.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  127.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  128.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  129.  
  130.     PORT_START      /* DSW1 */
  131.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Lives ) )
  132.     PORT_DIPSETTING(    0x00, "3" )
  133.     PORT_DIPSETTING(    0x01, "5" )
  134.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
  135.     PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
  136.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  137.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) )
  138.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  139.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  140.     PORT_DIPNAME( 0x08, 0x00, "Carry Bowls to Next Life" )
  141.     PORT_DIPSETTING(    0x08, DEF_STR( No ) )
  142.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  143.     PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coinage ) )
  144.     PORT_DIPSETTING(    0x10, "A 2/1 B 2/1" )
  145.     PORT_DIPSETTING(    0x20, "A 2/1 B 1/3" )
  146.     PORT_DIPSETTING(    0x00, "A 1/1 B 1/1" )
  147.     PORT_DIPSETTING(    0x30, "A 1/1 B 1/2" )
  148.     PORT_DIPSETTING(    0x40, "A 1/1 B 1/3" )
  149.     PORT_DIPSETTING(    0x50, "A 1/1 B 1/4" )
  150.     PORT_DIPSETTING(    0x60, "A 1/1 B 1/5" )
  151.     PORT_DIPSETTING(    0x70, "A 1/1 B 1/6" )
  152.     PORT_DIPSETTING(    0x80, "A 1/2 B 1/2" )
  153.     PORT_DIPSETTING(    0x90, "A 1/2 B 1/4" )
  154.     PORT_DIPSETTING(    0xa0, "A 1/2 B 1/6" )
  155.     PORT_DIPSETTING(    0xb0, "A 1/2 B 1/10" )
  156.     PORT_DIPSETTING(    0xc0, "A 1/2 B 1/11" )
  157.     PORT_DIPSETTING(    0xd0, "A 1/2 B 1/12" )
  158.     PORT_DIPSETTING(    0xf0, DEF_STR( Free_Play ) )
  159.     /* 0xe0 gives A 1/2 B 1/6 */
  160.  
  161.     PORT_START      /* IN1 */
  162.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  163.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
  164.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )
  165.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 )
  166.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  167.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  168.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  169.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  170.  
  171.     PORT_START      /* IN2 */
  172.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  173.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  174.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
  175.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  176.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  177.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  178.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  179.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  180.  
  181.     PORT_START      /* IN3 */
  182.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  183.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  184.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  185.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  186.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  187.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  188.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  189.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  190.  
  191.     PORT_START      /* IN4 */
  192.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  193.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  194.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  195.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  196.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  197.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  198.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  199.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  200.  
  201.     PORT_START      /* IN5 */
  202.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  203.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  204.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  205.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  206.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  207.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  208.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  209.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  210.  
  211.     PORT_START      /* DSW2 */
  212.     PORT_DIPNAME( 0x01, 0x00, "Coin Chutes" )
  213.     PORT_DIPSETTING(    0x01, "1" )
  214.     PORT_DIPSETTING(    0x00, "2" )
  215.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
  216.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  217.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  218.     PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Bonus_Life ) )
  219.     PORT_DIPSETTING(    0x04, "20000" )
  220.     PORT_DIPSETTING(    0x08, "40000" )
  221.     PORT_DIPSETTING(    0x0c, "20000 50000 +100K" )
  222.     PORT_DIPSETTING(    0x00, "None" )
  223.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) )
  224.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  225.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  226.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
  227.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  228.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  229.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
  230.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  231.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  232.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
  233.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  234.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  235. INPUT_PORTS_END
  236.  
  237.  
  238.  
  239.  
  240. static struct AY8910interface ay8910_interface =
  241. {
  242.     1,    /* 1 chip */
  243.     1500000,    /* 1.5 MHz?????? */
  244.     { 50 },
  245.     { 0 },
  246.     { 0 },
  247.     { 0 },
  248.     { arabian_portB_w }
  249. };
  250.  
  251.  
  252.  
  253. static struct MachineDriver machine_driver_arabian =
  254. {
  255.     /* basic machine hardware */
  256.     {
  257.         {
  258.             CPU_Z80 | CPU_16BIT_PORT,
  259.             4000000,    /* 4 Mhz */
  260.             readmem,writemem,0,writeport,
  261.             arabian_interrupt,1
  262.         }
  263.     },
  264.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  265.     1,    /* single CPU, no need for interleaving */
  266.     0,
  267.  
  268.     /* video hardware */
  269.     256, 256, { 0, 255, 11, 242 },
  270.     0,
  271.     32,32,
  272.     arabian_vh_convert_color_prom,
  273.  
  274.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  275.     0,
  276.     arabian_vh_start,
  277.     arabian_vh_stop,
  278.     arabian_vh_screenrefresh,
  279.  
  280.     /* sound hardware */
  281.     0,0,0,0,
  282.     {
  283.         {
  284.             SOUND_AY8910,
  285.             &ay8910_interface
  286.         }
  287.     }
  288. };
  289.  
  290.  
  291.  
  292. /***************************************************************************
  293.  
  294.   Game driver(s)
  295.  
  296. ***************************************************************************/
  297.  
  298. ROM_START( arabian )
  299.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  300.     ROM_LOAD( "ic1rev2.87",       0x0000, 0x2000, 0x5e1c98b8 )
  301.     ROM_LOAD( "ic2rev2.88",       0x2000, 0x2000, 0x092f587e )
  302.     ROM_LOAD( "ic3rev2.89",       0x4000, 0x2000, 0x15145f23 )
  303.     ROM_LOAD( "ic4rev2.90",       0x6000, 0x2000, 0x32b77b44 )
  304.  
  305.     ROM_REGION( 0x10000, REGION_GFX1 ) /* graphics roms */
  306.     ROM_LOAD( "ic84.91",      0x0000, 0x2000, 0xc4637822 )    /* because of very rare way */
  307.     ROM_LOAD( "ic85.92",      0x2000, 0x2000, 0xf7c6866d )  /* CRT controller uses these roms */
  308.     ROM_LOAD( "ic86.93",      0x4000, 0x2000, 0x71acd48d )  /* there's no way, but to decode */
  309.     ROM_LOAD( "ic87.94",      0x6000, 0x2000, 0x82160b9a )    /* it at runtime - which is SLOW */
  310. ROM_END
  311.  
  312. ROM_START( arabiana )
  313.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  314.     ROM_LOAD( "ic1.87",       0x0000, 0x2000, 0x51e9a6b1 )
  315.     ROM_LOAD( "ic2.88",       0x2000, 0x2000, 0x1cdcc1ab )
  316.     ROM_LOAD( "ic3.89",       0x4000, 0x2000, 0xb7b7faa0 )
  317.     ROM_LOAD( "ic4.90",       0x6000, 0x2000, 0xdbded961 )
  318.  
  319.     ROM_REGION( 0x10000, REGION_GFX1 ) /* graphics roms */
  320.     ROM_LOAD( "ic84.91",      0x0000, 0x2000, 0xc4637822 )    /* because of very rare way */
  321.     ROM_LOAD( "ic85.92",      0x2000, 0x2000, 0xf7c6866d )  /* CRT controller uses these roms */
  322.     ROM_LOAD( "ic86.93",      0x4000, 0x2000, 0x71acd48d )  /* there's no way, but to decode */
  323.     ROM_LOAD( "ic87.94",      0x6000, 0x2000, 0x82160b9a )    /* it at runtime - which is SLOW */
  324. ROM_END
  325.  
  326.  
  327.  
  328. GAMEX( 1983, arabian,  0,       arabian, arabian, 0, ROT270, "Sun Electronics", "Arabian", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  329. GAMEX( 1983, arabiana, arabian, arabian, arabian, 0, ROT270, "[Sun Electronics] (Atari license)", "Arabian (Atari)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  330.